/* 942. 增减字符串匹配 */
/**
 * @param {string} s
 * @return {number[]}
 */
var diStringMatch = function (s) {
    const n = s.length
    const ret = new Array(n + 1).fill(0)
    let min = 0, max = n

    for (let i = 0; i < n; i++) {
        ret[i] = s[i] === 'I' ? min++ : max--
    }
    ret[n] = min
    return ret
};
const ret = diStringMatch('IDID')
console.log('diStringMatch :>>', ret);